export default {
    data() {
        return {
            egTypeList: [
                { key: 'exam', title: '考试' },
                { key: 'exp', title: '课件' }
            ],
            typeList: [
                { key: 0, title: '上课', egType: 'exp', optionalExpType: [0] },
                { key: 1, title: '作业', egType: 'exp', optionalExpType: [0, 1, 2] },
                { key: 2, title: '考试', egType: 'exam', optionalExpType: [] }
            ],
            classTypeList: [
                { key: 'prelection', title: '讲课', type: 0 },
                { key: 'teaching', title: '教学', type: 0 }
            ]
        };
    },
    methods: {
        filterEgType(type) {
            if (!type) {
                return '-';
            }
            return this.egTypeList.find((item) => item.key === type).title;
        },
        filterType(type) {
            if (!type && type !== 0) {
                return '-';
            }
            return this.typeList.find((item) => item.key === type).title;
        },
        filterClassType(type) {
            if (!type) {
                return '-';
            }
            return this.classTypeList.find((item) => item.key === type).title;
        },
        filterStatus(val, type) {
            let value = Number(val);
            let str = '',
                color = '';
            switch (value) {
                case 0:
                    str = '未开始';
                    color = 'var(--status-pre)';
                    break;
                case 1:
                    str = '进行中';
                    color = 'var(--status-ing)';
                    break;
                case 2:
                    str = '已结束';
                    color = 'var(--status-deling)';
                    break;
            }
            return type === 'color' ? color : str;
        }
    }
};
